package de.andreavicentini.teatralia.generate;

import org.magiclabs.htmlx.*;
import java.util.*;
import de.andreavicentini.teatralia.pages.*;

public class Layout implements ILayout {
  protected static String nl;
  public static synchronized Layout create(String lineSeparator)
  {
    nl = lineSeparator;
    Layout result = new Layout();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "";
  protected final String TEXT_2 = NL + NL + "<html>" + NL + "<head>" + NL + "<LINK REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"teatralia.css\" TITLE=\"Style\">" + NL + "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">" + NL + "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=\"UTF-8\">" + NL + "<title>Teatralia Europa  |  ";
  protected final String TEXT_3 = "</title>" + NL + "" + NL + "<script>" + NL + "function toggle(name) {" + NL + "\tvalue = document.getElementById(name).style.display;" + NL + "\tif (value == 'none') " + NL + "\t\tvalue = \"\";" + NL + "\telse" + NL + "\t\tvalue = 'none';" + NL + "\t\t" + NL + "\tdocument.getElementById(name).style.display = value;" + NL + "}" + NL + "</script>" + NL + "</head>" + NL + "" + NL + "<!-- iso-8859-1 -->" + NL + "" + NL + "<body>" + NL + "" + NL + "\t";
  protected final String TEXT_4 = NL + NL + NL + "<div id=\"content\">";
  protected final String TEXT_5 = NL;
  protected final String TEXT_6 = NL + "</div>" + NL;
  protected final String TEXT_7 = NL;
  protected final String TEXT_8 = NL + NL + "</body>" + NL + "</html>";

	public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    stringBuffer.append(TEXT_1);
     Page page = (Page) argument;
TeatraliaSiteModel site = (TeatraliaSiteModel) page.getArea().getSiteModel();

    stringBuffer.append(TEXT_2);
    stringBuffer.append( page.getTitle() );
    stringBuffer.append(TEXT_3);
    stringBuffer.append( new Footer().generate(page) );
    stringBuffer.append(TEXT_4);
    stringBuffer.append(TEXT_5);
    stringBuffer.append( page.renderContent() );
    stringBuffer.append(TEXT_6);
    stringBuffer.append(TEXT_7);
    stringBuffer.append( new Footer().generate(page) );
    stringBuffer.append(TEXT_8);
    return stringBuffer.toString();
  }
}